home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 October / Chip Ekim 2003.iso / prog / code / contr / setup.exe / Disk1 / data1.cab / Paypal_En / Configuration / Commands / Insert PayPal View Cart.js < prev   
Encoding:
JavaScript  |  2003-07-18  |  6.4 KB  |  198 lines

  1. /*-----------------------------------------------------------------------------
  2. -    File Name:
  3. -        Insert PayPal View Cart.js
  4. -
  5. -    Description:
  6. -        Functions for View Cart wizard.
  7. -
  8. -    This file contains proprietary and confidential information from WebAssist.com
  9. -    corporation.  Any unauthorized reuse, reproduction, or modification without
  10. -    the prior written consent of WebAssist.com is strictly prohibited.
  11. -
  12. -    Copyright 2001 WebAssist.com Corporation.  All rights reserved.
  13. ------------------------------------------------------------------------------*/
  14. var CURRENTPAGE=0;
  15.  
  16. function commandButtons()     {
  17.   return new Array();
  18. }
  19.  
  20. /* Initialize the UI.  First thing that's called on the body load event. */
  21. function initializeUI()     {
  22.   if (navigator.platform.toLowerCase().indexOf("mac") >= 0)     {
  23.     
  24.     document.cancel.style = "position:absolute; width:70px; height:20px; z-index:90; left: 245px; top: 397px; visibility: visible";
  25.     document.cancel.document.btnCancel.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
  26.         
  27.     document.help.style = "position:absolute; width:70px; height:20px; z-index:90; left: 175px; top: 397px; visibility: visible";
  28.     document.help.document.btnHelp.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
  29.         
  30.     document.next.style = "position:absolute; width:70px; height:20px; z-index:90; left: 385px; top: 397px; visibility: visible";
  31.     document.next.document.btnNext.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
  32.         
  33.     document.back.style = "position:absolute; width:70px; height:20px; z-index:90; left: 315px; top: 397px; visibility: visible";
  34.     document.back.document.btnBack.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
  35.         
  36.     document.finish.style = "position:absolute; width:70px; height:20px; z-index:90; left: 385px; top: 397px; visibility: visible";
  37.     document.finish.document.btnFinish.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
  38.   
  39.     document.walogo.top = 402;
  40.     document.pplogo.top = 403;
  41.   }
  42.   document.back.visibility = "visible";
  43.   document.next.visibility = "visible";
  44.   document.help.visibility = "visible";
  45.   document.cancel.visibility = "visible";
  46.   var theDOM = dreamweaver.getDocumentDOM();
  47.   var theParent = theDOM.getSelectedNode();
  48.   var inForm = false;
  49.   while (theParent.parentNode)  {
  50.     theParent = theParent.parentNode;
  51.     if (theParent.tagName=="FORM")  {
  52.         inForm = theParent;
  53.         break;
  54.     }
  55.     }
  56.   if (inForm)  {
  57.     if (inForm.innerHTML.search(/<input type="[^"]*"[^>]*\sname="cmd"[^>]*>/i)>=0)  
  58.     {
  59.         alert(MSG_AlreadyPayPalInForm);
  60.         window.close();
  61.     }
  62.   }
  63.   MM.setBusyCursor();
  64.   showPageNum(0);
  65.   
  66.   getLastUID();  
  67.   enableDisableOtherImage("VC");
  68.  
  69.   MM.clearBusyCursor();
  70. }
  71.  
  72. /******************************** support functions ******************/
  73. function buildSummaryText()     {
  74.   var retVal = "";
  75.   var myImage = findObject("vcimage");
  76.   var myID = findObject("ppUID");
  77.   
  78.   retVal += "PayPal Account: " + myID.value;
  79.   retVal += "\n";
  80.   retVal += "Button Image URL: ";
  81.   for (var n=0; n<myImage.length; n++)
  82.   {
  83.     if (myImage[n].checked)
  84.     {
  85.       if (myImage[n].value == "other")
  86.       {
  87.         retVal += findObject("othervcimage").value;      
  88.       }
  89.       else
  90.       {
  91.         retVal += "http://images.paypal.com/images/" + myImage[n].value;      
  92.       }
  93.     }
  94.   }
  95.   return retVal;
  96. }
  97.  
  98. function openBrowseImageWindow()      {
  99.   var browseURL = "";
  100.   var LABEL_Select = "Select View Cart Image...";  // label for file window
  101.   browseURL = dreamweaver.browseForFileURL("select",LABEL_Select, false, true); // opens file window and returns file string as URL
  102.   if (browseURL)
  103.   {
  104.     //browseURL = WA_absoluteToRelativeURL(browseURL, docpath, false);          
  105.     findObject("othervcimage").value = browseURL;  //set the DataSource    
  106.   }
  107.   findObject("othervcimage").focus();
  108. }
  109.  
  110. /****************************** page functions ****************************/
  111. function Pg0_load()
  112. {
  113.   document.UserIDWP.visibility = "visible";
  114.   findObject("btnBack").setAttribute("disabled", "disabled"); // disable the back button
  115.   findObject("next").visibility = "visible";                  // enable next button
  116.   findObject("finish").visibility = "hidden";                 // hide finish button
  117.  
  118.   // Set focus but this only seems to work if you delay the page loading by some amount of time (in msec)
  119.   setTimeout('findObject("ppUID").focus()',500);
  120.   return true;
  121. }
  122.  
  123. function Pg0_unLoad()
  124. {
  125.   document.UserIDWP.visibility = "hidden";
  126.   return true;
  127. }
  128.  
  129. function Pg1_canLoad()      {
  130.   var ppError = validatePPUID();
  131.   if (ppError != "")
  132.   {
  133.     alert ("Account " + ppError);
  134.     return false;
  135.   }
  136.   return true;
  137. }
  138.  
  139. function Pg1_load()
  140. {
  141.   document.ButtonImageWP.visibility = "visible";
  142.   findObject("btnBack").setAttribute("disabled", "enabled"); // disable the back button
  143.   findObject("next").visibility = "visible";                  // enable next button
  144.   findObject("finish").visibility = "hidden";                 // hide finish button
  145.     // Set focus but this only seems to work if you delay the page loading by some amount of time (in msec)
  146.   setTimeout('findObject("vcimage")[0].focus()',500);
  147.   return true;
  148. }
  149.  
  150. function Pg1_unLoad()
  151. {
  152.   document.ButtonImageWP.visibility = "hidden";
  153.   return true;
  154. }
  155.  
  156. function Pg2_canLoad() 
  157. {
  158.   return true;
  159. }
  160.  
  161. function Pg2_load()
  162. {
  163.   document.SummaryWP.visibility = "visible";
  164.   findObject("btnBack").setAttribute("disabled", "enabled"); // disable the back button
  165.   findObject("next").visibility = "hidden";                  // enable next button
  166.   findObject("finish").visibility = "visible";                 // show finish button
  167.  
  168.   findObject("summaryText").value = buildSummaryText();
  169.   return true;
  170. }
  171.  
  172. function Pg2_unLoad()
  173. {
  174.   document.SummaryWP.visibility = "hidden";
  175.   return true;
  176. }
  177.  
  178. function showNextPage()   {
  179.   var nextPage = CURRENTPAGE + 1;
  180.   if (eval("Pg"+nextPage+"_canLoad()"))
  181.   {
  182.     eval("Pg"+CURRENTPAGE+"_unLoad()");
  183.     CURRENTPAGE++;
  184.     eval("Pg"+CURRENTPAGE+"_load()");  
  185.   }
  186. }
  187.  
  188. function showPreviousPage()   {
  189.   eval("Pg"+CURRENTPAGE+"_unLoad()");
  190.   CURRENTPAGE--;
  191.   eval("Pg"+CURRENTPAGE+"_load()");
  192. }
  193.  
  194. function showPageNum(pageNum)  {
  195.   eval("Pg"+CURRENTPAGE+"_unLoad()");
  196.   CURRENTPAGE = pageNum;
  197.   eval("Pg"+CURRENTPAGE+"_load()");
  198. }